Repository navigation
Conversation
…_minval wrf_dm_maxval_real and wrf_dm_minval_real reduced their (value, rank) pair with MPI_2REAL whatever the size of REAL, so with -r8 the MAXLOC and MINLOC compared the wrong bits and returned one rank's value instead of the domain maximum or minimum. The pair type now follows RWORDSIZE, as getrealmpitype does for single values. The index pair is INTEGER, so all four routines now broadcast it as MPI_INTEGER: the real variants sent it as MPI_REAL (right only because both are 4 bytes) and the doubleprecision variants as MPI_DOUBLE_PRECISION (16 bytes from an 8-byte buffer). A default build does the same as before.
Collaborator
|
The regression test results: |
dudhia
previously approved these changes
Dec 4, 2026
dudhia
left a comment
Collaborator
There was a problem hiding this comment.
A fix for double precision use
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
TYPE: bug fix
KEYWORDS: RSL_LITE, MPI, MAXLOC, MINLOC, double precision, -r8
SOURCE: Mark I. Richardson (Aeolis Research)
DESCRIPTION OF CHANGES:
Problem:
wrf_dm_maxval_real and wrf_dm_minval_real (external/RSL_LITE/module_dm.F) reduce their (value, rank) pair with MPI_2REAL whatever the size of REAL. With -r8 the pair is two 8-byte reals, so MAXLOC and MINLOC compare the wrong bits and return one rank's value, not the domain maximum or minimum. All four float variants also broadcast the INTEGER index pair as MPI_REAL or MPI_DOUBLE_PRECISION. Details in #2449.
Solution:
A new internal function getreal2mpitype returns MPI_2REAL or MPI_2DOUBLE_PRECISION by RWORDSIZE, as getrealmpitype does for MPI_REAL and MPI_DOUBLE_PRECISION, and the two real variants use it. All four routines broadcast the index pair as MPI_INTEGER. In a default (4-byte REAL) build the MPI types are the same as before.
ISSUE:
Fixes #2449
LIST OF MODIFIED FILES:
M external/RSL_LITE/module_dm.F
TESTS CONDUCTED:
RELEASE NOTE: In builds with 8-byte REAL (configure -r8) and MPI, the domain maximum and minimum from wrf_dm_maxval and wrf_dm_minval are now correct. They set the map-factor maxima that the adaptive time step uses for the number of acoustic steps, and several diagnostics.